-
-
Notifications
You must be signed in to change notification settings - Fork 397
Use PInvoke & Improve code comments & Use switch sentences #3652
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
@check-spelling-bot Report🔴 Please reviewSee the 📂 files view, the 📜action log, or 📝 job summary for details.
See ❌ Event descriptions for more information. Forbidden patterns 🙅 (1)In order to address this, you could change the content to not match the forbidden patterns (comments before forbidden patterns may help explain why they're forbidden), add patterns for acceptable instances, or adjust the forbidden patterns themselves. These forbidden patterns matched content: s.b. workaround(s)
If the flagged items are 🤯 false positivesIf items relate to a ...
|
🥷 Code experts: no user but you matched threshold 10 Jack251970 has most 👩💻 activity in the files. See details
Activity based on git-commit:
Knowledge based on git-blame:
Activity based on git-commit:
Knowledge based on git-blame:
Activity based on git-commit:
Knowledge based on git-blame: To learn more about /:\ gitStream - Visit our Docs |
Be a legend 🏆 by adding a before and after screenshot of the changes you made, especially if they are around UI/UX. |
📝 WalkthroughWalkthroughThis change introduces new Windows message and system command constants to the infrastructure layer and refactors window message handling in the main window logic. It adds explicit handling for non-client double-click and system command messages, reorganizes message dispatching, and updates drag-from-maximized behavior in the application's main window. Changes
Sequence Diagram(s)sequenceDiagram
participant User
participant MainWindow
participant Win32Helper
User->>MainWindow: MouseDown (on maximized window)
MainWindow->>MainWindow: Restore to Normal state, reposition
MainWindow->>MainWindow: Begin drag operation
User->>MainWindow: Non-client area double-click
MainWindow->>Win32Helper: Detect WM_NCLBUTTONDBLCLK
MainWindow->>MainWindow: Block default maximize/minimize
User->>MainWindow: Win+Up or Win+Down (system command)
MainWindow->>Win32Helper: Detect WM_SYSCOMMAND, SC_MAXIMIZE/SC_MINIMIZE
MainWindow->>MainWindow: Block maximize/minimize command
Possibly related PRs
Suggested labels
Suggested reviewers
Poem
📜 Recent review detailsConfiguration used: CodeRabbit UI 📒 Files selected for processing (3)
🧰 Additional context used🧬 Code Graph Analysis (2)Flow.Launcher.Infrastructure/Win32Helper.cs (1)
Flow.Launcher/MainWindow.xaml.cs (1)
⏰ Context from checks skipped due to timeout of 90000ms (3)
🔇 Additional comments (4)
✨ Finishing Touches
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
Could you please check if this has broken your fix? It works fine for me/ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR refactors window message handling by centralizing Win32 constants via PInvoke, improves code comments around snapping behavior, and converts legacy if
/else
chains into switch
statements.
- Migrate local Win32 message/command constants to
Win32Helper
andNativeMethods.txt
- Update
OnMouseDown
to useApplication.Current.Dispatcher.Invoke
and add explanatory comments - Refactor
WndProc
logic to aswitch
statement
Reviewed Changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.
File | Description |
---|---|
Flow.Launcher/MainWindow.xaml.cs | Updated drag handling comments, replaced BeginInvoke with sync Invoke , refactored WndProc to switch |
Flow.Launcher.Infrastructure/Win32Helper.cs | Added PInvoke-backed constants for window messages/commands |
Flow.Launcher.Infrastructure/NativeMethods.txt | Appended new message and command names for documentation |
Comments suppressed due to low confidence (1)
Flow.Launcher/MainWindow.xaml.cs:492
- Using a synchronous
Dispatcher.Invoke
on the UI thread may block rendering; consider usingBeginInvoke
orInvokeAsync
to avoid potential UI jank.
Application.Current?.Dispatcher.Invoke(new Action(() =>
In my tests, there were no particular issues. It behaves the same as my PR. |
Follow on with #3606 to provide code quality improvement.